<template>
  <div class="bargain-list">
    <div class="header"></div>
    <div class="list">
      <div
        class="item acea-row row-between-wrapper"
        v-for="(item, index) in bargainLis"
        :key="index"
      >
        <div class="pictrue"><img :src="item.image" /></div>
        <div class="text acea-row row-column-around">
          <div class="line1" v-text="item.title"></div>
          <div class="num">
            <span class="iconfont icon-pintuan"></span
            >{{ item.people }}人正在参与
          </div>
          <div class="money font-color-red">
            可砍至: ￥<span class="price" v-text="item.min_price"></span>
          </div>
        </div>
        <div class="cutBnt bg-color-red" @click="goDetail(item.id)">
          <span class="iconfont icon-kanjia"></span>参与砍价
        </div>
      </div>
      <div class="load font-color-red" v-if="!status" @click="getBargainList">
        点击加载更多
      </div>
    </div>
  </div>
</template>
<script>
import { getBargainList } from "@api/activity";
export default {
  name: "GoodsBargain",
  components: {},
  props: {},
  data: function() {
    return {
      bargainLis: [
        {
          image:"http://activity.crmeb.net/public/uploads/attach/2019/05/29//51308e61ace45968fdef953b2ac6c241.jpg",
          title:"【雷神911Air星战】雷神(ThundeRobot)911Air星战二代旗舰版15.6英寸窄边框游戏笔记本电脑i79750H512GSSDRGB键盘GTX1650",
          people:"5678",
          min_price:"1000.00",
          id:"9"
        },{
          image:"http://datong.crmeb.net/public/uploads/attach/2019/01/15/5c3dc0ef27068.jpg",
          title:"智米加湿器 白色",
          people:"2389",
          min_price:"249.00",
          id:"3"
        },{
          image:"http://activity.crmeb.net/public/uploads/attach/2019/05/30//0eecbfbca9ebc315c2882590fd55a209.jpg",
          title:"伊利酸奶畅轻整箱装乳酸菌燕麦黄桃草莓早餐奶250克9瓶风味发酵乳",
          people:"6587",
          min_price:"80.00",
          id:"11"
        },{
          image:"http://activity.crmeb.net/public/uploads/attach/2019/05/29//6f2a1ece45e307f274e3384410a3bd3a.jpg",
          title:"【华为畅享9S】华为HUAWEI畅享9S6GB+64GB珊瑚红全网通2400万超广角三摄珍珠屏大存储移动联通电信4G手机双卡双待",
          people:"56789",
          min_price:"100.00",
          id:"7"
        }
      ], //砍价列表
      status: false, //砍价列表是否获取完成 false 未完成 true 完成
      loading: false, //当前接口是否请求完成 false 完成 true 未完成
      page: 1, //页码
      limit: 20 //数量
    };
  },
  mounted: function() {
    this.getBargainList();
  },
  methods: {
    getBargainList: function() {
      var that = this;
      if (that.loading) return;
      if (that.status) return;
      that.loading = true;
      getBargainList({ page: that.page, limit: that.limit }).then(res => {
        that.status = res.data.length < that.limit;
        that.bargainLis.push.apply(that.bargainLis, res.data);
        that.page++;
        that.loading = false;
      });
    },
    goDetail: function(id) {
      this.$router.push({
        path: "/activity/dargain_detail/" + id + "/0"
      });
    }
  }
};
</script>
<style scoped>
.router{
  background-color:rgb(253,51,35);
}
</style>
